Skip to content

Instantly share code, notes, and snippets.

@amkisko
amkisko / abstract.md
Last active May 8, 2024 11:15
ActiveAdmin v4 tailwind configuration
$ rails new . -n ActiveAdminDemo -c tailwind -a propshaft --skip-test --skip-system-test

$ rails g active_admin:install --skip-users
$ rails tailwindcss:install
$ rails generate active_admin:assets
$ cat tailwind-active_admin.config.js | sed 's/require(`@activeadmin\/activeadmin\/plugin`)/require(`${activeAdminPath}\/plugin.js`)/g' > config/tailwind-active_admin.config.js
$ rm tailwind-active_admin.config.js
$ bundle binstub tailwindcss-rails
$ rails generate active_admin:views
@a-laughlin
a-laughlin / command-line-reference.md
Last active May 8, 2024 11:15
Command Line Reference bash sed diff awk vim
@laughinghan
laughinghan / Every possible TypeScript type.md
Last active May 8, 2024 11:14
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];
@diachedelic
diachedelic / deep-link-from-browser.js
Last active May 8, 2024 11:11
Deep link to a native app from a browser, with a fallback
@gabydd
gabydd / config.toml
Last active May 8, 2024 11:07
helix lf
[keys.normal]
C-f = [":new", ":insert-output lf-pick", "split_selection_on_newline", "goto_file", "goto_last_modification", "goto_last_modified_file", ":buffer-close!", ":theme nord", ":theme default"]
# replace the default after theme with the theme you use
# open 1 with the open command (l and <left> to open) or more with (<space> to select) then quit
# all opened files will be opened in helix
@emxsys
emxsys / wget_google_drive_download.md
Last active May 8, 2024 11:06
Download Google Drive files with WGET

How to download files from Google Drive with WGET

Step 1. Get the ID of the file to download

  1. Get a shareable link from Google Drive by right-clicking the file and selecting Get Shareable Link.

  2. Examine the link to get the file's ID. Example:

    https://docs.google.com/open?id=[ID]

Step 2. Download the file with WGET

  1. Build the download URL using the ID obtained in Step 1. Example:
@dsample
dsample / README.md
Last active May 8, 2024 11:06
ASCII art diagrams

ASCI art characters for creating diagrams

Characters:

Single line

  • ASCII code 191 = ┐ ( Box drawing character single line upper right corner )
  • ASCII code 192 = └ ( Box drawing character single line lower left corner )
  • ASCII code 193 = ┴ ( Box drawing character single line horizontal and up )
  • ASCII code 194 = ┬ ( Box drawing character single line horizontal down )
@lukepighetti
lukepighetti / config.toml
Last active May 8, 2024 11:06
Helix – tree file picker... TODAY?!?
[keys.normal]
C-f = [":new", ":insert-output lf-pick", ":theme default", "select_all", "split_selection_on_newline", "goto_file", "goto_last_modified_file", ":buffer-close!", ":theme tokyonight_storm"]
@mjbalcueva
mjbalcueva / password-input.tsx
Last active May 8, 2024 11:06
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {